package vpnservice

import (
	"vpn-management-server/logger"
	"vpn-management-server/src/dao/userdao"
	"vpn-management-server/src/dao/vpndao"
	"vpn-management-server/src/model/vpnmodel"
)

func GetVpnServerInfoByUserName(name string) []*vpnmodel.VpnServerInfo {
	ugid := userdao.GetUGroupIDByUserName(name)
	if ugid == -1 {
		// 获取失败直接返回空
		logger.Logger.Warn("get ugroup id by user name fail")
		return []*vpnmodel.VpnServerInfo{}
	}
	VpnServerInfos := vpndao.GetAllVpnServerInfosByUGroupID(ugid)
	return VpnServerInfos
}
